﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Web.Helper;
using Microsoft.WindowsAzure;
using System.Configuration;
using Web.Models;

namespace Web.Controllers
{
    public class JSonController : Controller
    {
        [HttpGet]
        [Authorize]
        public ActionResult SendSaudo(string receiver, string text)
        {
            SaudoLogic logic = new SaudoLogic();
            Saudo saudo = logic.SendSaudo(HttpContext.User.Identity.Name, receiver, text);
            return Json(saudo, JsonRequestBehavior.AllowGet);
        }

        [HttpGet]
        public ActionResult VoteSaudo(string key)
        {
            SaudoLogic logic = new SaudoLogic();
            logic.VoteSaudo(key);
            return Json(true, JsonRequestBehavior.AllowGet);
        }

        [HttpGet]
        public ActionResult CommentSaudo(string key, string text)
        {
            SaudoLogic logic = new SaudoLogic();
            logic.CommentSaudo(key, text);
            return Json(true, JsonRequestBehavior.AllowGet);
        }
    }
}
